package com.ruoyi.jkcrData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jkcrData.domain.plat.DataJkcrGzyy;
import com.ruoyi.jkcrData.domain.plat.JkcrGzyyParaChange;
import com.ruoyi.jkcrData.service.IDataJkcrGzyyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 架空乘人工作油压测试数据Controller
 * 
 * @author ruoyi
 * @date 2024-02-19
 */
@RestController
@RequestMapping("/jkcrData/gzyy")
@Api(value="架空乘人-工作油压测试",tags = "架空乘人-工作油压接口")
public class DataJkcrGzyyController extends BaseController
{
    @Autowired
    private IDataJkcrGzyyService dataJkcrGzyyService;

    /**
     * 查询架空乘人工作油压测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:gzyy:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataJkcrGzyy dataJkcrGzyy)
    {
        startPage();
        List<DataJkcrGzyy> list = dataJkcrGzyyService.selectDataJkcrGzyyList(dataJkcrGzyy);
        return getDataTable(list);
    }

    /**
     * 导出架空乘人工作油压测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:gzyy:export')")
    @Log(title = "架空乘人工作油压测试数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataJkcrGzyy dataJkcrGzyy)
    {
        List<DataJkcrGzyy> list = dataJkcrGzyyService.selectDataJkcrGzyyList(dataJkcrGzyy);
        ExcelUtil<DataJkcrGzyy> util = new ExcelUtil<DataJkcrGzyy>(DataJkcrGzyy.class);
        util.exportExcel(response, list, "架空乘人工作油压测试数据数据");
    }

    /**
     * 获取架空乘人工作油压测试数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:gzyy:query')")
    @GetMapping(value = "/{gzyyId}")
    public AjaxResult getInfo(@PathVariable("gzyyId") Long gzyyId)
    {
        return success(dataJkcrGzyyService.selectDataJkcrGzyyByGzyyId(gzyyId));
    }

    /**
     * 新增架空乘人工作油压测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:gzyy:add')")
    @Log(title = "架空乘人工作油压测试数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataJkcrGzyy dataJkcrGzyy)
    {
        return toAjax(dataJkcrGzyyService.insertDataJkcrGzyy(dataJkcrGzyy));
    }
    /**
     * 修改架空乘人-工作油压
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:modifyGzyy:edit')")
    @Log(title = "修改架空乘人-工作油压", businessType = BusinessType.UPDATE)
    @PutMapping("/modifyGzyy")
    @ApiOperation(value="修改架空乘人-工作油压")
    public AjaxResult modifyGzyy(@ApiParam(name="运行速度数据",value="传入json格式",required=true)@RequestBody JkcrGzyyParaChange jkcrGzyyParaChange)
    {
        return AjaxResult.success(dataJkcrGzyyService.modifyDataJkcrGzyy(jkcrGzyyParaChange));
    }

    /**
     * 修改架空乘人工作油压测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:gzyy:edit')")
    @Log(title = "架空乘人工作油压测试数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataJkcrGzyy dataJkcrGzyy)
    {
        return toAjax(dataJkcrGzyyService.updateDataJkcrGzyy(dataJkcrGzyy));
    }

    /**
     * 修改架空乘人工作油压测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:gzyy:edit')")
    @Log(title = "修改架空乘人工作油压测试数据", businessType = BusinessType.UPDATE)
    @PutMapping("/delGzyy/{gzyyId}")
    @ApiOperation(value="修改架空乘人工作油压测试数据")
    public AjaxResult delGzyy(@PathVariable Long gzyyId)
    {
        return toAjax(dataJkcrGzyyService.updateDataJkcrGzyyByGzyyId(gzyyId));
    }

    /**
     * 删除架空乘人工作油压测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:gzyy:remove')")
    @Log(title = "架空乘人工作油压测试数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{gzyyIds}")
    public AjaxResult remove(@PathVariable Long[] gzyyIds)
    {
        return toAjax(dataJkcrGzyyService.deleteDataJkcrGzyyByGzyyIds(gzyyIds));
    }
}
